<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<link href="/stylesheets/framework.css" media="screen" rel="Stylesheet" type="text/css" />
<%= javascript_include_tag "util" %>
<script language="javascript">
function showProductWindow(id)
{
    window.open("/product/product_info/"+id,"_blank","height=500,width=750,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}
</script>
</head>
<BODY>
<div id="container">
<div id="main">
<h1>订单管理 - <span id="secondHeading">订单信息</span></h1>
<span id="test"></span>
<table id="LIST_TB">
  <tbody>
    <tr>
      <td id="LIST_TB_TITLE" colspan="4" align="center">订货单</td>
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td>购 买 方：</td>
      <td><%=@sale_paper.agent.name%></td>
 <td>客户订单号：</td>
      <td><%=@sale_paper.customer_book_no%></td>
     
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td >订单日期：</td>
      <td colspan="4"><%=@sale_paper.sale_date_at%></td>
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td>联系人：</td>
      <td><%=@sale_paper.agent_people%></td>
     <td>客户TEL：</td>
      <td><%=@sale_paper.agent_phone%></td> 
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td>客户收货地址： </td>
      <td><%=@sale_paper.agent_address%></td>
      <td>客户FAX：</td>
      <td><%=@sale_paper.agent_fax%></td>
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td>销售方：</td>
      <td><%=@sale_paper.sale_company%></td>
      <td>公司地址：</td>
      <td><%=@sale_paper.sale_address%></td>
    </tr>
    <tr id="LIST_TB_CONTENT1">
      <td>公司电话：</td>
      <td><%=@sale_paper.sale_phone%></td>
      <td>公司传真:</td>
      <td><%=@sale_paper.sale_fax%></td>
    </tr>
    <tr align="center" id="LIST_TB_TITLE">
      <td colspan="4">订货明细</td>
    </tr>
    <tr>
      <td colspan="4">
      <table id="LIST_TB" style="width:100%">
        <tbody>
          <tr id="LIST_TB_CONTENT2">
            <td style="text-align: center;">序号</td>
            <td style="text-align: center;">品名规格</td>
            <td style="text-align: center;">导针规格</td>
            <td style="text-align: center;">数量（kpcs）</td>
            <td style="text-align: center;">单价（元）</td>
            <td style="text-align: center;">小计（元）</td>
            <td style="text-align: center;">发货单号</td>
            <td style="text-align: center;">件数</td>
            <td style="text-align: center;">备注</td>
          </tr>
          <%serial=0%>
          <%totalCount=0%>
          <%totalPrice=0%>
          <%@sale_paper.salePaperItems.each do |item|%>
          <tr id="LIST_TB_CONTENT1">
            <td><%=serial%></td>
            <td><a href="javascript:showProductWindow(<%=item.product.id%>)"><%=item.product.serial%></a></td>
            <td><a href="javascript:showProductWindow(<%=item.product.id%>)"><%=item.product.name%></a></td>
            <td><%totalCount+=item.current_count%><%=item.current_count%></td>
            <td><%totalPrice+=item.current_count*item.price%><%=item.price%></td>
            <td><%=sprintf("%#.2f",item.current_count*item.price)%></td>
            <td><%=item.serial%></td>
            <td><%=item.goods_num%></td>
            <td><%=item.memo%></td>
            <%serial=serial+1%>
          </tr>
          <%end%>
          <tr id="LIST_TB_CONTENT2">
            <td style="text-align: center;">合计</td>
            <td style="text-align: center;"></td>
            <td style="text-align: center;"></td>
            <td style="text-align: center;"><%=totalCount%></td>
            <td style="text-align: center;"></td>
            <td style="text-align: center;"><%=sprintf("%#.2f",totalPrice)%></td>
            <td style="text-align: center;"></td>
            <td style="text-align: center;"></td>
            <td style="text-align: center;"></td>
          </tr>
        </tbody>
      </table>
      </td>
    </tr>
 
  </tbody>
</table>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                </td>
        </tr>
</table>
</div>
</div>
</BODY>
</HTML>
